package com.yuw.baozhuang;

public class TestDriver {
    public static void main(String[] args) {
        test01();
    }

    /**
     * 包装类、基本类型、String类型之间的相互转化
     */
    private static void test01(){
        // 基本类型
        int iVal0 = 10;
        // 包装类类型
        // 基本类型--->包装类类型
        Integer integer0 = new Integer(iVal0);
        // 默认转换
        Integer integer1 = iVal0;

        int iVal1 = integer1.intValue();
        int iVal11 = integer0;
        System.out.println("iVal11="+iVal11);

        String str0 = integer0.toString();
        String str11 = "10";
        Integer integer12 = Integer.valueOf(str11);

        String str20 = iVal0+"";
        int iVal20 = Integer.parseInt(str20);

        System.out.println("=============================");
        //////////////////
        String string60 = "10";
        int iVal60 = 10; // 十进制的10
        int iVal61 = Integer.parseInt(string60,16);
        System.out.println("iVal61="+iVal61);
        System.out.println("10的二进制："+Integer.toBinaryString(iVal60));
        System.out.println("10的二进制："+Integer.toOctalString(iVal60));
    }
}
